]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
tray: fix so that trayicons using symbolic icons get the right colors
authorDan Winship <danw@gnome.org>
Mon, 31 Jan 2011 17:48:18 +0000 (12:48 -0500)
committerDan Winship <danw@gnome.org>
Mon, 7 Feb 2011 15:01:12 +0000 (10:01 -0500)
The tray protocol only allows setting a single set of colors for all
symbolic trayicons; we use the message-tray's theme node to set that.

https://bugzilla.gnome.org/show_bug.cgi?id=641060

data/theme/gnome-shell.css
js/ui/main.js
js/ui/statusIconDispatcher.js
src/shell-tray-manager.c
src/shell-tray-manager.h

index 5f5edfcefac804105806514d6d4be2c0ecdad008..3e7cc8112c510c550abe8a9497fec6560428a4f8 100644 (file)
@@ -857,13 +857,13 @@ StTooltip StLabel {
     background-gradient-start: rgba(0,0,0,0.01);
     background-gradient-end: rgba(0,0,0,0.95);
     height: 36px;
+    color: white;
 }
 
 #notification {
     font-size: 16px;
     border-radius: 5px 5px 0px 0px;
     background: rgba(0,0,0,0.9);
-    color: white;
     padding: 8px 8px 4px 8px;
     spacing-rows: 10px;
     spacing-columns: 10px;
@@ -1012,10 +1012,6 @@ StTooltip StLabel {
     height: 36px;
 }
 
-.summary-source {
-    color: white;
-}
-
 .summary-source-button {
     padding-left: 3px;
     padding-right: 3px;
index 5366546a0e0e43fd286826a15675dc522a75a1d0..8f8725bec0d8f283e1fda5d639b4f6a728d412d9 100644 (file)
@@ -144,7 +144,9 @@ function start() {
     notificationDaemon = new NotificationDaemon.NotificationDaemon();
     windowAttentionHandler = new WindowAttentionHandler.WindowAttentionHandler();
     telepathyClient = new TelepathyClient.Client();
+
     panel.startStatusArea();
+    statusIconDispatcher.start(messageTray.actor);
 
     ctrlAltTabManager = new CtrlAltTab.CtrlAltTabManager();
     ctrlAltTabManager.addGroup(panel.actor, _("Panel"), 'gnome-panel');
index c48f2765efe953a338b27f92dfa9b69f5b0c7356..e159b399413b2f248744da646c309443b2cdbfa4 100644 (file)
@@ -31,7 +31,6 @@ StatusIconDispatcher.prototype = {
         this._traymanager = new Shell.TrayManager();
         this._traymanager.connect('tray-icon-added', Lang.bind(this, this._onTrayIconAdded));
         this._traymanager.connect('tray-icon-removed', Lang.bind(this, this._onTrayIconRemoved));
-        this._traymanager.manage_stage(global.stage);
 
         // Yet-another-Ubuntu-workaround - we have to kill their
         // app-indicators, so that applications fall back to normal
@@ -40,6 +39,10 @@ StatusIconDispatcher.prototype = {
         Util.killall('indicator-application-service');
     },
 
+    start: function(themeWidget) {
+        this._traymanager.manage_stage(global.stage, themeWidget);
+    },
+
     _onTrayIconAdded: function(o, icon) {
         let wmClass = (icon.wm_class || 'unknown').toLowerCase();
         let role = STANDARD_TRAY_ICON_IMPLEMENTATIONS[wmClass];
index 370297ffa05e4dda2db8af5ff0c2c9ebb9668b92..0d126e9205ae5368fa3168d7f93938dc73a4b275 100644 (file)
@@ -192,9 +192,40 @@ shell_tray_manager_new (void)
   return g_object_new (SHELL_TYPE_TRAY_MANAGER, NULL);
 }
 
+static void
+shell_tray_manager_style_changed (StWidget *theme_widget,
+                                  gpointer  user_data)
+{
+  ShellTrayManager *manager = user_data;
+  StThemeNode *theme_node;
+  StIconColors *icon_colors;
+  GdkColor foreground, warning, error, success;
+
+  theme_node = st_widget_get_theme_node (theme_widget);
+  icon_colors = st_theme_node_get_icon_colors (theme_node);
+
+  foreground.red = icon_colors->foreground.red * 0x101;
+  foreground.green = icon_colors->foreground.green * 0x101;
+  foreground.blue = icon_colors->foreground.blue * 0x101;
+  warning.red = icon_colors->warning.red * 0x101;
+  warning.green = icon_colors->warning.green * 0x101;
+  warning.blue = icon_colors->warning.blue * 0x101;
+  error.red = icon_colors->error.red * 0x101;
+  error.green = icon_colors->error.green * 0x101;
+  error.blue = icon_colors->error.blue * 0x101;
+  success.red = icon_colors->success.red * 0x101;
+  success.green = icon_colors->success.green * 0x101;
+  success.blue = icon_colors->success.blue * 0x101;
+
+  na_tray_manager_set_colors (manager->priv->na_manager,
+                              &foreground, &warning,
+                              &error, &success);
+}
+
 void
 shell_tray_manager_manage_stage (ShellTrayManager *manager,
-                                 ClutterStage     *stage)
+                                 ClutterStage     *stage,
+                                 StWidget         *theme_widget)
 {
   Window stage_xwindow;
   GdkWindow *stage_window;
@@ -228,6 +259,10 @@ shell_tray_manager_manage_stage (ShellTrayManager *manager,
   g_object_unref (stage_window);
 
   na_tray_manager_manage_screen (manager->priv->na_manager, screen);
+
+  g_signal_connect (theme_widget, "style-changed",
+                    G_CALLBACK (shell_tray_manager_style_changed), manager);
+  shell_tray_manager_style_changed (theme_widget, manager);
 }
 
 static void
index d9916319a0ab4fbe06093a5a1bc23014b73ab8ff..bc4dc4e935d3c6d01749ad035d0cd5666dd9c901 100644 (file)
@@ -4,6 +4,7 @@
 #define __SHELL_TRAY_MANAGER_H__
 
 #include <clutter/clutter.h>
+#include "st.h"
 
 G_BEGIN_DECLS
 
@@ -41,7 +42,8 @@ GType             shell_tray_manager_get_type     (void);
 
 ShellTrayManager *shell_tray_manager_new          (void);
 void              shell_tray_manager_manage_stage (ShellTrayManager *manager,
-                                                   ClutterStage     *stage);
+                                                   ClutterStage     *stage,
+                                                   StWidget         *theme_widget);
 
 G_END_DECLS